package cn.com.huzo.repository.master.impl;

import cn.com.huzo.model.entities.master.MpsItemUsageRuleEntity;
import cn.com.huzo.repository.master.MpsItemUsageRuleRepository;
import huzofw.repository.impl.GenericRepositoryImpl;
import huzofw.repository.impl.MyBatisDaoUtils;
import java.util.List;
import org.springframework.stereotype.Repository;

/**
 * 主产品计划项目授权数据访问对象。
 *
 * @author 吴旭
 */
@Repository("MpsItemUsageRuleRepository")
public class MpsItemUsageRuleRepositoryImpl extends GenericRepositoryImpl<MpsItemUsageRuleEntity, String>
        implements MpsItemUsageRuleRepository {

    private final String namespace = "cn.com.huzo.repository.master.MpsItemUsageRuleRepository";

    /**
     * 构造函数,设置the entity to MspItemRepositoryImpl.class.
     */
    public MpsItemUsageRuleRepositoryImpl() {
        super(MpsItemUsageRuleEntity.class);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer batchInsert(List<MpsItemUsageRuleEntity> itemList) {
        return getSqlSession().insert(MyBatisDaoUtils.getMapperQueryId(
                namespace, "batchInsert"), itemList);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer revokeByUserId(List<MpsItemUsageRuleEntity> itemList) {
        return getSqlSession().delete(MyBatisDaoUtils.getMapperQueryId(
                namespace, "revokeByUserId"), itemList);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer revoke(Long userId) {
        return getSqlSession().delete(MyBatisDaoUtils.getMapperQueryId(
                namespace, "revoke"), userId);
    }
}
